package com.example.sourcesprng.jdk17._switch;

public class TestJDK17_Switch {

    public static void main(String[] args) throws Exception {
        int i = 1;
        switch (i) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                System.out.println("工作日");
                break;
            case 6:
            case 7:
                System.out.println("周末");
                break;
            default:
                throw new Exception("录入错误");
        }

        switch (i){
            case 1,2,3,4,5 -> System.out.println("工作日");
            case 6,7 -> System.out.println("周末");
            default -> throw new Exception("录入错误");
        }

        switch (i) {
            case 1 -> System.out.println("周一");
            case 2 -> System.out.println("周二");
            case 3 -> System.out.println("周三");
            case 4 -> System.out.println("周四");
            case 5 -> System.out.println("周五");
            case 6 -> System.out.println("周六");
            case 7 -> System.out.println("周天");
            default -> throw new Exception("异常录入，请检查");
        }
    }
}
